import {
  Link,
  Switch,
  Route,
  Redirect,
} from "react-router-dom/cjs/react-router-dom";
import Son from "./Son";
import Son2 from "./Son2";
import "./index.css";
import Dynamic from "./Dynamic";
export default function Father() {
  return (
    <div className="">
      我是父亲组件
      <div className="list">
        <Link to="/father/Son">Son</Link>
      </div>
      <div className="list">
        <Link
          to={{
            pathname: "/father/Son2",
            search: "?name=zks",
            state: { points: 66 },
          }}
        >
          Son2 query传递擦参数
        </Link>

        {/* <Link to="/father/Son2?name=15">Son2 query传递擦参数</Link> */}
      </div>
      <div className="list">
        <Link to="/father/Dynamic/1" replace>
          动态路由 params参数
        </Link>
      </div>
      <Switch>
        <Route path="/father/Son">
          <Son />
        </Route>
        <Route path="/father/Son2">
          <Son2 />
        </Route>

        <Route path="/father/Dynamic/:id">
          <Dynamic></Dynamic>
        </Route>
        <Redirect to="/father/Son"></Redirect>
      </Switch>
    </div>
  );
}
